import { Button, Input, Divider, Calendar } from "antd-mobile";
import React, { useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { resever } from "../../store/home/homeSlice";
import { useNavigate } from "react-router-dom";



const Home = () => {
  const start = useSelector((state) => state.home.start);
  const end = useSelector((state) => state.home.end);
  const date = useSelector((state) => state.home.date);

  const dispatch = useDispatch();
  const navigate = useNavigate();

  return (
    <div>
      <div style={{ display: "flex", justifyContent: "space-between" }}>
        <Input
          placeholder="开始"
          value={start}
          onClick={() => navigate("/city?type=start")}
        ></Input>
        <Divider>
          <span onClick={() => dispatch(resever())}>反转</span>
        </Divider>
        <Input
          placeholder="结束"
          value={end}
          onClick={() => navigate("/city?type=end")}
        ></Input>
      </div>
      <Divider></Divider>
      <Input placeholder="日期" value={date} onClick={() => navigate('/cal')}></Input>
      <Divider></Divider>
      <Button>查询</Button>

    
    </div>
  );
};

export default Home;
